//
//  ClientOrderManageController.m
//  YunKang
//
//  Created by leoking870 on 2017/9/26.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import "YKClientOrderManageController.h"
#import "TFSegmentConfigModel.h"
#import <TFSegmentView.h>
#import "YKClientOrderListViewController.h"
#import "YKTabBarViewController.h"
@interface YKClientOrderManageController ()

@end

@implementation YKClientOrderManageController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"客户订单管理";
    self.segmentView.backgroundColor = [UIColor whiteColor];
}

- (NSArray *)titlesForViewControllers {
    return @[@"全部订单", @"待审批", @"待发货", @"待收货", @"已收货", @"退货中", @"已退货"];
}

- (TFSegmentConfigModel *)segmentConfigModel {
    TFSegmentConfigModel *configModel = [[TFSegmentConfigModel alloc] init];
    configModel.contentInsets = UIEdgeInsetsMake(0, 8, 0, 8);
    configModel.itemMinWidth = 75;
    configModel.itemSpace = 15;
    configModel.textColor = [UIColor tf_colorWithHexString:@"#040404"];
    configModel.selectedTextColor = TFSTYLE(buttonEnableBackgroundColor);
    configModel.lineColor = TFSTYLE(buttonEnableBackgroundColor);
    configModel.lineInsets = UIEdgeInsetsMake(42, 0, 0, 0);
    configModel.fillSegmentWithItemsWhenLessCount = NO;
    
    return configModel;
}

- (void)beginSearchWithText:(NSString *)text {
    YKClientOrderListViewController *viewController = (YKClientOrderListViewController *) [self currentViewController];
    viewController.c_name = text;
    [viewController startLoadDataSilently];
}

- (void)didScrollToIndex:(NSUInteger)index {
    YKClientOrderListViewController *viewController = (YKClientOrderListViewController *) [self currentViewController];
    viewController.c_name = [self searchText];
    [viewController startLoadDataSilently];
}

- (UIViewController *)viewControllerAtIndex:(NSUInteger)index {
    YKClientOrderListViewController *vc = [YKClientOrderListViewController new];
    vc.c_name = [self searchText];
    //2 审批中 3 待发货 4 待收货 5 已收货 空字符传查询全部
    switch (index) {
        case 0:
            vc.istatus = @"";
            break;
        case 1:
            vc.istatus = @"2";
            break;
        case 2:
            vc.istatus = @"3";
            break;
        case 3:
            vc.istatus = @"4";
            break;
        case 4:
            vc.istatus = @"5";
            break;
        case 5:
            vc.istatus = @"9";
            break;
        case 6:
            vc.istatus = @"10";
            break;
        default:
            vc.istatus = @"";
            break;
    }
    return vc;
}

@end
